<?php
require_once ("JcerClient.php");

// set jcer server list
$servers = array (array ('host' => "127.0.0.1", 'port' => 3261 ) );

/*
 * test echo task
 */
$client = new JcerClient ();
$client->setServers ( $servers );
for($i = 1; $i < 5; $i ++) {
	$client->addTask ( JcerClient::TASKID_ECHO, $i, "Hello Jcer$i" );
}
$data = $client->getResponse ();
print_r ( $data );

/*
 * test http task
 */
$client = new HttpJcerClient ();
$client->setServers ( $servers );
for($i = 1; $i < 5; $i ++) {
	$client->addUrl ( $i, "http://www.baidu.com" );
}
$data = $client->getResponse ();
print_r ( $data );

/*
 * test sql task
 */
$client = new SqlJcerClient ();
$client->setServers ( $servers );
for($i = 1; $i < 5; $i ++) {
	$client->addSql ( "default", $i, "select User,Host from mysql.user limit $i,1" );
}
$data = $client->getResponse ();
print_r ( $data );
